open Ax.Math
module B = Ax.Behavior
module O = Ax.Component
open Ax.Color


let static color n =
  O.rect B.(const ({w=n;h=n}, color))

let dynamic color b =
  O.rect B.(b >>| fun x -> ({w = 100 ; h = 100 + x * 20 }, color))

let blue_rect =
  dynamic blue B.(time >>| fun x -> x * 2)

let red_rect =
  O.fold ~init:0 ~f:(fun _ i -> i + 1)
    (dynamic red)

let app =
  O.(arm `H [ red_rect
            ; blue_rect
            ; arm `V [ static black 100
                     ; static green 150
                     ; static pink 200 ] ])

;; Ax_js.init app
